<?php

namespace App\Modules\LuckDraw\Models;

class ModelFactory {
    private static $_models;
    public static function get(string $modelName, array $params) {
        $className = __NAMESPACE__ . '\\' . $modelName;
        if(!class_exists($className)){
            return null;
        }
        if (isset(self::$_models[$modelName])){
            return self::$_models[$modelName];
        }
        self::$_models[$modelName] = new $className($params);
        return self::$_models[$modelName];
    }
}